package com.dingpeikeji.quickdeer.mobile.service;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import com.dingpeikeji.quickdeer.core.common.persistence.Page;
import com.dingpeikeji.quickdeer.core.common.utils.DateUtils;
import com.dingpeikeji.quickdeer.core.modules.orders.dao.TOrdersDao;
import com.dingpeikeji.quickdeer.core.modules.orders.entity.TOrders;
import com.dingpeikeji.quickdeer.core.modules.realsche.entity.TRealsche;
import com.dingpeikeji.quickdeer.core.modules.site.entity.TSitedtl;
import com.dingpeikeji.quickdeer.core.modules.site.service.TSitedtlService;
import com.dingpeikeji.quickdeer.mobile.dao.CitySceneryDao;
import com.dingpeikeji.quickdeer.mobile.entity.CitySceneryInfo;
import com.dingpeikeji.quickdeer.modules.realsche.dao.FRealscheDao;
import com.dingpeikeji.quickdeer.modules.rentproduct.dao.TDemandsDao;
import com.dingpeikeji.quickdeer.modules.rentproduct.entity.DemandsReact;
import com.dingpeikeji.quickdeer.modules.rentproduct.entity.TDemands;
import com.google.common.collect.Maps;

@Service
@Transactional(readOnly = true)
public class CitySceneryService {
	
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private CitySceneryDao  citySceneryDao;
	
	/**
	 * 获取景点list
	 */
	public List<CitySceneryInfo> getCitySceneryList(String[] code) {
		List<CitySceneryInfo> scenery=new ArrayList<CitySceneryInfo>();
		for(int i=0;i<code.length;i++){
			String j=code[i];
			scenery.addAll(citySceneryDao.getCitySceneryList(j));
		}
		return scenery;
	}
	
	/**
	 * 获取搜索景点
	 */
	public List<CitySceneryInfo> getScenerySearch(String[] code,String name) {
		List<CitySceneryInfo> scenery=new ArrayList<CitySceneryInfo>();
		for(int i=0;i<code.length;i++){
			String j=code[i];
			scenery.addAll(citySceneryDao.getScenerySearch(j, name));
		}
		
		return scenery;
	}
	
	/**
	 * 插入行程必游景点
	 */
	public Integer insertCityScenery(CitySceneryInfo info){
		return citySceneryDao.insertCityScenery(info);
	}
	
	/**
	 * 根据tripId查询对应景点
	 */
	public String[] getCitySceneryListByTripId(String tripId){
		
		List<CitySceneryInfo> a=citySceneryDao.getCitySceneryListByTripId(tripId);
		String[] name=new String[a.size()];
		for(int i=0;i<a.size();i++){
			name[i]=citySceneryDao.getNameById(a.get(i).getScenery());
		}
		return name;
	}

	
}
